<?php
// ------------------------------------------------------------------------------------
// Bestand:       Question
// Versie:        1.0
// Projekt:       Cursus MasterClass van Eduvision
// Datum:         14-07-2008
// Auteur(s):     Ronald Obbens
// Email(s):      ronaldobbens@gmail.com
// Revisie(s):	  
//
// Beschrijving:  the question class changes en gets the question stuf
// ------------------------------------------------------------------------------------
//

class Question extends Query 
{
	private $m_iId;
	private $m_sQuestion;
	private $m_sDate;
	private $m_iUser;
	private $m_sKeywords;
	private $m_sAnswer;
	private $m_sAnwerdate;
	private $m_iAnsweruserid;
	

	public function __construct()
	{
		$this->setTable('Question');
	}
	
	/**
	 * Set the primairy key in the query
	 *
	 * @param unknown_type $p_iId
	 */
	public function setByParentId($p_iId)
	{
		$this->setPrimairyKey($p_iId);
		$this->m_iId = $this->get('id');
		$this->m_sQuestion = (string) $this->get('question');
		$this->m_sDate = (string) $this->get('date');
		$this->m_iUser = (int) $this->get('Users_id');
		$this->m_sKeywords = (string) $this->get('keywords');
		$this->m_sAnswer = (string) $this->get('answer');
		$this->m_sAnwerdate =  (string) $this->get('answerdate');
		$this->m_iAnsweruserid = (int) $this->get('answeruserid');
	}
		
	
	/**
	 * Get question id
	 *
	 * @return int questionId
	 */
	public function getId()
	{
		return $this->m_iId;
	}
	
	/**
	 * Get Askers user id
	 *
	 * @return int askers userid
	 */
	public function getUserId()
	{
		return $this->m_iUser;
	}
	
	/**
	 * Set Askers UserId
	 *
	 * @param int $p_iUserId
	 */
	public function setUserId($p_iUserId)
	{
		$this->m_iUser = $p_iUserId;
		$this->set('Users_id',$p_iUserId);
	}
	
	/**
	 * get question
	 *
	 * @return String
	 */
	public function getQuestion()
	{
		return $this->m_sQuestion;
	}
	
	/**
	 * set question
	 *
	 * @param string $p_sQuestion
	 */
	public function setQuestion($p_sQuestion)
	{
		$this->m_sQuestion = $p_sQuestion;
		$this->setByParentId((integer)$this->set('question',$p_sQuestion)->getRecordID());
	}
	
	/**
	 * get question date
	 *
	 * @return timestamp
	 */
	public function getQuestionDate()
	{
		return $this->m_sDate;
	}
	
	/**
	 * set question date
	 *
	 * @param timestamp $p_sQuestionDate
	 */
	public function setQuestionDate($p_sQuestionDate)
	{
		$this->m_sDate = $p_sQuestionDate;
		$this->set('date',$p_sQuestionDate);
	}
	
	/**
	 * get the answer to the question
	 *
	 * @return string
	 */
	public function getAnswer()
	{
		return $this->m_sAnswer	;
	}
	
	/**
	 * set the answer to the question
	 *
	 * @param string $p_sAnswer
	 */	
	public function setAnswer($p_sAnswer)
	{
		$this->m_sAnswer = $p_sAnswer;
		$this->set('answer',$p_sAnswer);
	}
	
	/**
	 * Get the date of the answer
	 *
	 * @return timestamp
	 */
	public function getAnswerDate()
	{
		return $this->m_sAnwerdate;
	}
	
	/**
	 * set the date of the answer
	 *
	 * @param timestamp $p_sAnswerdate
	 */
	public function setAnswerDate($p_sAnswerdate)
	{
		$this->m_sAnwerdate = $p_sAnswerdate;
		$this->set('answerdate',$p_sAnswerdate);
	}
	
	/**
	 * Get user of answer
	 *
	 * @return integer
	 */	
	public function getAnswerrer()
	{
		return $this->m_iAnsweruserid;
	}
	
	/**
	 * set user of answer
	 *
	 * @param integer $p_iAnswerrerid
	 */
	public function setAnswerrer($p_iAnswerrerid)
	{
		$this->m_iAnsweruserid = $p_iAnswerrerid;
		$this->set('answeruserid',$p_iAnswerrerid);
	}
	
	public function getKeywords()
	{
		return $this->m_sKeywords;
	}
	
	public function setKeywords($p_sKeywords)
	{
		$this->m_sKeywords = $p_sKeywords;
		$this->set('keywords',$p_sKeywords);
	}
	
}
?>